package com.taylor.seckill.controller;


import com.taylor.seckill.rabbitmq.MQSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author taylor
 * @since 2021-04-08
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private MQSender mqSender;

    @RequestMapping("/mq")
    public void rabbitTest(){
        mqSender.send("hello rabbit");
    }

    @RequestMapping("/mq/fanout")
    public void fanoutTest(){
        mqSender.sendFanout("fanout msg");
    }

    @RequestMapping("/mq/direct")
    public void directTest(){
        mqSender.sendDirect1("direct route1 msg");
        mqSender.sendDirect2("direct route2 msg");
    }

    @RequestMapping("/mq/topic")
    public void topicTest(){
        mqSender.sendTopic1("topic route1 msg");
        mqSender.sendTopic2("topic route2 msg");
    }
}
